package coms.itboyes.bycommon;

import android.app.Activity;
import android.app.Application;

import java.lang.ref.WeakReference;
import java.util.LinkedList;
import java.util.List;

/**
 * Created by admin on 2017/1/13.
 */

public class MyApplication extends Application {

    public static MyApplication applicationContext;

    private List<WeakReference<Activity>> activityList = new LinkedList<>();
    public static MyApplication getContextInstance() {
        return applicationContext;
    }

    public static void setContextInstance(MyApplication applicationContext) {
        MyApplication.applicationContext = applicationContext;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        applicationContext=this;
    }

    public void addActivity(Activity activity) {
        activityList.add(new WeakReference<Activity>(activity));
    }
}
